Skip to content

[mypyc] Add 'bit' primitive type and streamline branching#9606

Merged
JukkaL merged 13 commits into
masterfrom
mypyc-bit-etc
Oct 17, 2020
Merged

[mypyc] Add 'bit' primitive type and streamline branching#9606
JukkaL merged 13 commits into
masterfrom
mypyc-bit-etc

Conversation

@JukkaL

@JukkaL JukkaL commented Oct 17, 2020

Copy link
Copy Markdown
Collaborator

Add the bit primitive type that only has two valid values: 0 and 1. The existing
boolean primitive type is different as it also supports a third value (for error).
This makes boolean a poor fit for low-level IR operations which never raise an
exception.

Use bit as the result type of comparison operations and various primitives.

Also simplify the branch operation to not have a special mode for branching on
negative values, since it's needlessly ad hoc. Primitives still support this mode,
but it gets converted away during IR building.

Work on mypyc/mypyc#748.

@JukkaL

JukkaL commented Oct 17, 2020

Copy link
Copy Markdown
Collaborator Author

I'm going to merge this as soon as I have a green build, since this will get stale very quickly. A review would still be appreciated, and I will respond to review feedback in a separate PR if this PR has already been merged.

@JukkaL JukkaL merged commit 5db3e1a into master Oct 17, 2020
@JukkaL JukkaL deleted the mypyc-bit-etc branch October 17, 2020 15:44

@TH3CHARLie TH3CHARLie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Looking forward to seeing its boost on performance

@JukkaL

JukkaL commented Oct 18, 2020

Copy link
Copy Markdown
Collaborator Author

Looking forward to seeing its boost on performance

This probably has no direct impact of performance, but this will be useful when working on non-C backends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants